package cn.test.service;

import java.util.Collection;

import cn.test.Exception.ExistingException;
import cn.test.Exception.NoExistingException;
import cn.test.dao.impl.IAccountDaoImpl;
import cn.test.model.Account;

public class AccountOperation implements IAccount {
	IAccountDaoImpl idi = new IAccountDaoImpl();
	
	public Collection<Account> getAllAccount() {
		
		return idi.getAllAccount();
	}

	public boolean addAccount(Account account) {
		
		try {
			idi.addAccount(account);
		} catch (ExistingException e) {
		}
		return true;
	}

	public boolean removeAccount(String account) {
		try {
			idi.removeAccount(account);
		} catch (NoExistingException e) {
		}
		return false;
	}

	public boolean alterAccount(String account, String password) {
		try {
			idi.alterAccount(account, password);
		} catch (NoExistingException e) {
		}
		return false;
	}

	public Account lookAccount(String account) {
		try {
			return idi.lookAccount(account);
		} catch (NoExistingException e) {
		
		}
		return null;
		
	}
}
